﻿using System;
using System.Collections.Generic;
using System.Text;
namespace SQLite
{
    /// <summary>
    /// 表的Attribute
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
    public class TableAttribute : Attribute
    {
        /// <summary>
        /// 表名
        /// </summary>
        public string TableName { get; set; }
        /// <summary>
        /// 表名
        /// </summary>
        /// <param name="tableName"></param>
        public TableAttribute(string tableName)
        {
            TableName = tableName;
        }

        public override bool Equals(object obj)
        {
            var attribute = obj as TableAttribute;
            return attribute != null &&
                   base.Equals(obj) &&
                   TableName == attribute.TableName;
        }

        public override int GetHashCode()
        {
            var hashCode = 808890972;
            hashCode = hashCode * -1521134295 + base.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(TableName);
            return hashCode;
        }
    }


}
